import java.util.Scanner;

/**
 * create by Sun
 * 2018/8/13
 */
public class Tree {
    private int data;
    private Tree next;

    public int getData() {
        return data;
    }

    public void setData(int data) {
        this.data = data;
    }

    public Tree getNext() {
        return next;
    }

    public void setNext(Tree next) {
        this.next = next;
    }

    public static void main(String[] args) {
        Tree tree=new Tree();
        Tree head=new Tree();

        Tree p=head;
        Tree q=null;
        Scanner sc=new Scanner(System.in);
        for(int i=0;i<4;i++){
            q=new Tree();
            //逆序
//            q.data=sc.nextInt();
//            q.next=head.next;
//            head.next=q;
            //正序
            q.data=sc.nextInt();
            q.next=null;
            p.next=q;
            p=q;
        }

        p=head.next;
        while(p!=null){
            System.out.print(p.data+" ");
            p=p.next;
        }

    }
}
